import { createSlice } from "@reduxjs/toolkit";
import { CounterShema } from "../types/CounterShema";

const initialState: CounterShema = {
  value: 0,
};
export const counterSlice = createSlice({
  name: "counter",
  initialState,
  reducers: {
    increment: (state) => {
      state.value += 1;
    },
    decrement: (state) => {
      state.value -= 1;
    },
  },
});

export const { increment, decrement } = counterSlice.actions;
export const { reducer: counterReducer } = counterSlice;
